﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using DAL;

namespace BIZ
{
    public class AccountBIZ : BaseClass
    {
        public ACCOUNT Login(string username, string password)
        {
            password = WebUtils.GetMd5Hash(password);
            var n = DB.ACCOUNTs.Count(a => a.Username.Equals(username) && a.Password.Equals(password));
            if (n == 0)
            {
                return null;
            }
            var account = DB.ACCOUNTs.SingleOrDefault(a => a.Username.Equals(username) && a.Password.Equals(password));

            return account;
        }
    }
}
